package com.shopyourstyle.activities;

import java.util.Date;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.GridView;

import com.shopyourstyle.R;



public class ProductsPage extends Activity{
	private ProductAdapter adapter;
	private GridView gridview;
	private ProductInfo[] productinfoArray;
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.productspage);
	    Bundle extras = getIntent().getExtras();
	    String key = extras.getString("key");
	    if(Data.database.containsKey(key)){
	    	productinfoArray = Data.database.get(key);
	    	Log.e("here","contains");
	    }
	    else{
	    	if(Data.database.containsKey("t1_p1")){
	    		productinfoArray = Data.database.get("t1_p1");
	    			if(productinfoArray==null)
	    				Log.e("here","don't contain");
	    			
	    	}
	    	Log.e("here","nothing in database");
	    }
	    
	    gridview = (GridView) findViewById(R.id.gridview);
	    adapter=new ProductAdapter(this, productinfoArray);
	    gridview.setAdapter(adapter);
	}
    public void onDestroy()
    {
        adapter.imageLoader.stopThread();
        gridview.setAdapter(null);
        
        super.onDestroy();            
        //adapter.imageLoader.clearCache();
        //adapter.notifyDataSetChanged();
    }
    // fake data

}
